package jasonllinux.app.memo;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;

public class Activity01 extends Activity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
    }
    
  //menu不需要布局和配置
  	@Override
  	public boolean onCreateOptionsMenu(Menu menu) {
  		
  		menu.add(0, 1, 1, R.string.exit);
  		menu.add(0, 2, 2, R.string.about);
  		return super.onCreateOptionsMenu(menu);
  		
  	}

  	@Override
  	public boolean onOptionsItemSelected(MenuItem item) {
  		if(item.getItemId() == 1) {
  			finish();
  		}else if(item.getItemId() == 2) {
  			Intent intent = new Intent();
  			intent.setClass(Activity01.this, ActivityAbout.class);
  			Activity01.this.startActivity(intent);
  			
  		}
  		return super.onOptionsItemSelected(item);
  	}
}